
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
 
int main(int argc, char **argv)
{
    int fd;
    int count=0;
    char buf[]={0x11,0x22,0x33,0x44,0x55};
    fd = open("/dev/mini2440_spi", O_RDWR);

    if (fd < 0) {
        perror("open device spi");
        exit(1);
    }
    
    count=write(fd,buf,sizeof(buf)/sizeof(buf[0]));
    read(fd,buf,1);
    printf("read byte is: 0x%02X\n",buf[0]);
    close(fd);
    return 0;
}